﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Ylh.FactoryDAL;
using Ylh.IDAL;
using System.Data;

namespace Ylh.BLL
{
    public class NoteBLL
    {
        private string ConStr;
        public NoteBLL(string ConStr)
        {
            this.ConStr = ConStr;
        }

        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int InsertNote(Ylh.Model.TbNote model)
        {
            Ylh.IDAL.INote IN = DataAccess.CreateINote();
            return IN.InsertNote(ConStr, model);
        }
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool UpdateNote(Ylh.Model.TbNote model)
        {
            Ylh.IDAL.INote IN = DataAccess.CreateINote();
            return IN.UpdateNote(ConStr, model);
        }
        /// <summary>
        /// 删除一条数据
        /// </summary>
        public bool Delete(int NoteID)
        {
            Ylh.IDAL.INote IN = DataAccess.CreateINote();
            return IN.Delete(ConStr, NoteID);
        }
        /// <summary>
        /// 删除一条数据
        /// 设置为不可用,但是未删除数据
        /// </summary>
        public bool Deletestate(int NoteID)
        {
            Ylh.IDAL.INote IN = DataAccess.CreateINote();
            return IN.Deletestate(ConStr, NoteID);
        }
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Ylh.Model.TbNote GetModel(int NoteID)
        {
            Ylh.IDAL.INote IN = DataAccess.CreateINote();
            return IN.GetModel(ConStr, NoteID);
        }
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public DataTable GetList(string strWhere)
        {
            Ylh.IDAL.INote IN = DataAccess.CreateINote();
            return IN.GetList(ConStr, strWhere);
        }

        public void Delete(List<string> li)
        {
            foreach (string str in li)
            {
                Delete(Convert.ToInt32(str));
            }
        }
    }
}
